<template>
  <div class="hello">
    <Homeheader></Homeheader>
	<Homeswiper :imgUrl="getimgarr"></Homeswiper>
	<Homeicon :icons="geticons"></Homeicon>
	<Homeposition></Homeposition>
	<Shopping></Shopping>
	<Ranking></Ranking>
	<Favorite :list="getlikes"></Favorite>
	<AllProducts :info="getinfo"></AllProducts>
	<Footer></Footer>
  </div>
</template>

<script>
	import Homeheader from './Home-header'
	import Homeswiper from './Home-swiper'
	import Homeicon from './Home-icon'
	import Homeposition	from './Home-position'
	import Shopping from './Shopping'
	import Ranking from './Ranking'
	import Favorite	from './Favorite'
	import axios from 'axios'
	import AllProducts from './AllProducts'
	import Footer from './Footer'
export default {
  name: 'Home',
  data () {
    return {
			getimgarr:[],
			geticons:[],
			getlikes:[],
			getinfo:[]
    }
  },
	components:{
		Homeheader,
		Homeswiper,
		Homeicon,
		Homeposition,
		Shopping,
		Ranking,
		Favorite,
		AllProducts,
		Footer
	},
	methods:{
		getHomedata(){
			// 两个参数,一个是地址,第二是回调函数，与.then 相同
			// axios.get("/api/Home.json",this.getHomedataBack)
			axios.get("/api/Home.json")
			.then(res=>{
				// console.log(res.data.info)
				this.getimgarr = res.data.imgUrl
				this.geticons = res.data.icons
				this.getlikes = res.data.list
				this.getinfo = res.data.info
			})
// 		},
// 		getHomedataBack(){
// 			this.getimgarr = res.data.imgUrl
// 			this.geticons = res.data.icons
// 			this.getlikes = res.data.list
		}
	},
	mounted(){
		this.getHomedata()
	}
}
</script>
<style>
	
</style>

